package com.qlslylq.ad.sdk.model.req;

import com.qlslylq.ad.sdk.application.AdMergeSDK;
import com.qlslylq.ad.sdk.constant.AppConst;
import com.qlslylq.ad.sdk.enums.AdEventSign;
import com.qlslylq.ad.sdk.enums.OsType;
import com.qlslylq.ad.sdk.method.AppMethod;

import java.io.Serializable;

/**
 * 添加埋点数据<br/>
 */
public class AppBehaviorAddDTO implements Serializable {

    private String behaviorSign;

    private String eventSign;

    private String userCode;

    private int osType;

    private String version;

    private String sdkVersion;

    private String location;

    public AppBehaviorAddDTO(String behaviorSign, String eventSign, String userCode, int osType, String version, String sdkVersion, String location) {
        this.behaviorSign = behaviorSign;
        this.eventSign = eventSign;
        this.userCode = userCode;
        this.osType = osType;
        this.version = version;
        this.sdkVersion = sdkVersion;
        this.location = location;
    }

    public String getBehaviorSign() {
        return behaviorSign;
    }

    public void setBehaviorSign(String behaviorSign) {
        this.behaviorSign = behaviorSign;
    }

    public String getEventSign() {
        return eventSign;
    }

    public void setEventSign(String eventSign) {
        this.eventSign = eventSign;
    }

    public String getUserCode() {
        return userCode;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    public int getOsType() {
        return osType;
    }

    public void setOsType(int osType) {
        this.osType = osType;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getSdkVersion() {
        return sdkVersion;
    }

    public void setSdkVersion(String sdkVersion) {
        this.sdkVersion = sdkVersion;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    /**
     * 构造埋点模型<br/>
     */
    public static AppBehaviorAddDTO build(AdEventSign eventSign) {
        long mediaId = -1;
        if (AdMergeSDK.getMediaWebVO() != null) {
            mediaId = AdMergeSDK.getMediaWebVO().getMediaId();
        }
        return new AppBehaviorAddDTO(eventSign.getName(), "self", AppMethod.getDeviceId(), OsType.Android.getId(), AppConst.SERVER_API_VERSION + "_" + AppConst.SDK_API_VERSION, AppConst.SDK_API_VERSION, String.valueOf(mediaId));
    }
}
